home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / D-G / File Dropper 1.1b3 / (FD Starter) / FD Interface.h next >
Encoding:
C/C++ Source or Header  |  1993-08-29  |  5.4 KB  |  213 lines  |  [TEXT/KAHL]

  1. /*****
  2.  * FD Interface.h
  3.  *
  4.  * Copyright © 1993 Troy Anderson; All rights reserved.
  5.  *
  6.  * Written by Troy Anderson
  7.  *
  8.  * Header file for File Dropper, with all of the prototypes and definitions you need to interface
  9.  * with the File Dropper π library.  See the comments before the function prototypes below for
  10.  * explanations of their use.  See the read me accompanying this file for general information
  11.  * about what this is and how to use it.
  12.  *
  13.  * Version 1.1ß3
  14.  *****/
  15.  
  16.  
  17. #pragma once
  18.  
  19. /**
  20.  ** message values
  21.  **
  22.  ** These are the values that will be passed to you via the message parameter in
  23.  ** ModuleMain.
  24.  **/ 
  25.  
  26. enum { 
  27.     eStartup, 
  28.     eAEInitialize, 
  29.     eSFInitialize, 
  30.     eValidateFile, 
  31.     eProcessFile, 
  32.     eUserCancelled, 
  33.     eDispose, 
  34.     eDoAboutBox, 
  35.     eQuitting,
  36.     eIdle
  37. };
  38.  
  39.  
  40. /**
  41.  ** ModuleDataRec
  42.  **
  43.  ** A pointer to this structure is passed to you in ModuleMain
  44.  **/ 
  45.  
  46. typedef struct {
  47.     FSSpec    *theFile;
  48.     long    refcon;
  49.     } ModuleDataRec;
  50.  
  51.  
  52. /**
  53.  ** rAboutStringsID
  54.  ** 
  55.  ** This is the ID of the STR# resource that you should put your About information
  56.  ** in.  If something is in there, it will be displayed when the user picks the 
  57.  ** About item in the Apple menu.
  58.  **/
  59. #define    rAboutStringsID        129
  60.  
  61. /**
  62.  ** Customization function types
  63.  **
  64.  ** These three function types are needed only if you want to override the standard
  65.  ** get file stuff.
  66.  **/
  67.  
  68. /*
  69.  * For this function, return TRUE if theFile points to the file the user selected,
  70.  * return FALSE if the user cancelled.
  71.  */
  72. typedef Boolean         (*CustomGetFSSpecFunc)( FSSpec *theFile, long *refcon);
  73.  
  74. /* 
  75.  * The next two functions are identical to the ones described in Inside Macintosh
  76.  * when using a custom file filter or a custom dialog hook function with SFGetFile.
  77.  * See Volume I, page 523.
  78.  */
  79. typedef pascal Boolean    (*CustomFileFilterFunc)( fileParam *pbp);
  80. typedef pascal short    (*CustomDialogHookFunc)( short item, DialogPtr theDialog);
  81.  
  82.  
  83.  
  84. /**
  85.  ** Customization function installation routines
  86.  **
  87.  ** Call these functions to install custom handlers for the GetFile, FileFilter, and DialogHook
  88.  ** when using the GetFile interface.
  89.  **/
  90.  
  91. void InstallCustomGetFSSpecFunc( CustomGetFSSpecFunc *theFunction);
  92. void InstallCustomFileFilterFunc( CustomFileFilterFunc *theFunction);
  93. void InstallCustomDialogHookFunc( CustomDialogHookFunc *theFunction);
  94.  
  95.  
  96.  
  97. /**
  98.  ** Setting up status dialog parameters
  99.  **
  100.  ** Call this function to tell File Dropper if you want the status dialog to be shown and
  101.  ** what info you want in it.  If showStatusDialog is TRUE, the dialog will show up while
  102.  ** files are being processed.  If showProgressBar is TRUE, a progress bar (like the Finder's
  103.  ** file copying progress bar) will be in the status window for you to use (see SetStatusPercentage
  104.  **    below).  If customMessage is not NULL, the pascal string in it will be written in the
  105.  ** status dialog.  CustomMessage would be something like "\pNow processing your files..."
  106.  **
  107.  ** Defaults:
  108.  **     showStatusDialog is TRUE
  109.  **        showProgressBar is FALSE
  110.  **        customMessage is NULL
  111.  **
  112.  ** If you call this function, call it in response to eStartup, eAEInitialize, or eSFInitialize only.
  113.  **/
  114.  
  115. void SetStatusParams( Boolean showStatusDialog, Boolean showProgressBar, StringPtr customMessage);
  116.  
  117.  
  118. /**
  119.  ** Status bar percentage change routine
  120.  **
  121.  ** Call this function to show the user how far along you are on your file.  Pass
  122.  ** in ther percentage (a number from 0 to 100).  This only does anything if you have
  123.  ** previously called SetStatusParams and set showProgressBar to TRUE.
  124.  **/
  125.  
  126. void SetStatusPercentage( short percentage);
  127.  
  128.  
  129. /**
  130.  ** CustomMessage change routine
  131.  **
  132.  ** Call this function to change the text in the customMessage on the fly while you are
  133.  ** processing files.  This only does anything if there is a status dialog (as there is, by
  134.  ** default).
  135.  **/
  136.  
  137. void ChangeStatusMessage( StringPtr customMessage);
  138.  
  139.  
  140. /**
  141.  ** ModuleMain
  142.  **
  143.  ** This is the entrypoint into your part of the code.
  144.  **/
  145.  
  146. Boolean ModuleMain( short message, ModuleDataRec *moduleData);
  147.  
  148.  
  149.  
  150.  
  151. /**
  152.  ** Useful Utilities
  153.  **
  154.  ** You may find the following functions useful, and are free to use them.
  155.  **/
  156.  
  157. /*
  158.  * These values can be passed to ErrorAlert, but are meaningless to FailOSErr
  159.  */
  160. typedef enum {
  161.     eWrongMachine    = 1,
  162.     eSmallSize,
  163.     eNoMemory,
  164.     eBadResourceFile,
  165.     eAppleEventError,
  166.     eOSError,
  167.     eCantReadFile,
  168.     eModuleError
  169. }ErrorType;
  170.  
  171.  
  172.     /* 
  173.      * Puts up an alert for the user with a message corresponding to error, followed by 
  174.      * aPString.  When the user clicks OK, it returns, the application does not quit.
  175.      * aPString can be NULL.
  176.      */
  177. void ErrorAlert( ErrorType error, StringPtr aPString);
  178.  
  179.  
  180.     /* 
  181.      * Puts up an alert for the user with aPString as the message.  When the user clicks OK,
  182.      * it returns, the application does not quit.
  183.      */
  184. void ShowError( StringPtr aPString);
  185.  
  186.  
  187.     /*
  188.      * If error is 0, this function simply returns, otherwise it puts up an
  189.      * alert for the user that says that an OS Error occurred, followed by the 
  190.      * value of error.  When the user clicks OK, the application quits.  The 
  191.      * eQuitting message does NOT get sent.
  192.      */
  193. void FailOSErr( OSErr error);
  194.  
  195.  
  196.     /* 
  197.      * Returns TRUE if the key corresponding to theKeyCode is being pressed
  198.      * at the time of the call
  199.      */
  200. Boolean KeyIsDown( short theKeyCode);
  201.  
  202.  
  203.     /*
  204.      * Constants that can be used in calls to KeyIsDown
  205.      */
  206. #define    TAB_KEY            (0x30)
  207. #define    SPACE_KEY        (0x31)
  208. #define COMMAND_KEY        (0x37)
  209. #define    SHIFT_KEY        (0x38)
  210. #define    CAPS_LOCK_KEY    (0x39)
  211. #define OPTION_KEY        (0x3A)
  212. #define    CONTROL_KEY        (0x3B)
  213.